package com.ming.yourdiary.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;
import android.view.ViewGroup;

import java.util.List;

public class MainPageViewPagerAdapter extends FragmentStatePagerAdapter {
  private List<Fragment> mFragments;

  public MainPageViewPagerAdapter(FragmentManager fragmentManager, List<Fragment> fragments) {
    super(fragmentManager);
    this.mFragments = fragments;
  }

  @Override
  public Fragment getItem(int arg0) {
    return mFragments.get(arg0);
  }

  @Override
  public int getCount() {
    return mFragments.size();
  }

  // 初始化每个页卡选项
  @Override
  public Object instantiateItem(ViewGroup arg0, int arg1) {
    return super.instantiateItem(arg0, arg1);
  }

  @Override
  public void destroyItem(ViewGroup container, int position, Object object) {
    super.destroyItem(container, position, object);
  }

}